package org.sso.common.util;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;

public class GsonHelper {
	private static Gson gson = new GsonBuilder().create();

	public static String jsonString(Object obj) {
		return gson.toJson(obj);
	}

	public static <T> T toObj(String json, TypeToken<T> type) {
		return gson.fromJson(json, type.getType());
	}
}
